<%@ page import="com.yinhai.core.common.api.config.impl.SysConfig"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<jsp:directive.page import="java.util.Date" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<%@ taglib prefix="ta" tagdir="/WEB-INF/tags/tatags"%>

<html xmlns="http://www.w3.org/1999/xhtml" style="height:100%">
<head>
<title>wx配置</title>
</head>
<%@ include file="/ta/inc.jsp"%>
<body >
	<ta:pageloading />
	<ta:box minWidth="1000" fit="true" cssStyle="margin-top:5px">
		<ta:panel id="pnlSmsQry" key="查询条件" cols="3" >
			<ta:text id="appid" key="appid" />
			<ta:text id="wxName" key="公众号名称" />
			<ta:buttonLayout>
				<ta:button id="wxQry" isok="true" key="查询" onClick="fnQuery()" />
				<ta:button id="wxClear" key="清空" onClick="fnClear()" />
			</ta:buttonLayout>
		</ta:panel>
		<ta:panel id="pnlApp" key="已配置的公众号" withToolBar="true" fit="true" columnWidth="0.25">
			<ta:panelToolBar>
				<ta:button id="btnAdd" key="新增[A]" hotKey="a" icon="icon-add" isShowIcon="true" asToolBarItem="true" onClick="fnAdd()" />
			</ta:panelToolBar>
			<ta:datagrid id="wxgrid" fit="true" haveSn="true" clickActiveStyle="true" forceFitColumns="true" >
				<ta:datagridItem id="id" key="id" hiddenColumn="true"/>
				<ta:datagridItem id="name" key="公众号名称" />
				<ta:datagridItem id="appid" key="appid" sortable="true"/>
				<ta:datagridItem id="secret" key="secret" hiddenColumn="true"/>
				<ta:datagridItem id="defaultwx" key="默认公众号" collection="YESORNO"/>
				<ta:datagridItem id="edit" key="编辑" icon="icon-edit" click="fnUpdate" width="50"/>
				<ta:datagridItem id="remove" key="删除" icon="icon-remove" click="fnDelete" width="50"/>
			</ta:datagrid>
		</ta:panel>
	</ta:box>
</body>
</html>
<script type="text/javascript">
	
	$(document).ready(function() {
		$("body").taLayout();
        fnQuery();
	});
	
	/*查询 */
	function fnQuery(){
		Base.clearGridDirty("wxgrid");
		Base.submit("pnlSmsQry","wxRegisterController!queryWx.do");
	}
	
	/* 新增 */
	function fnAdd(){
		Base.openWindow("addWx","添加wx账号信息","wxRegisterController!toAddWx.do",null, 650, 250,  null,null,true);
	}
	
	/* 编辑 */
	function fnUpdate(r){
		Base.openWindow("editWx","编辑wx账号信息","wxRegisterController!toEditWx.do",
		{"dto['id']":r.id,"dto['appid']":r.appid,"dto['secret']":r.secret,"dto['name']":r.name,"dto['defaultwx']":r.defaultwx},
		650, 250, null,null,true);
	}
	
	/* 删除 */
	function fnDelete(r){
		Base.confirm("确定删除吗?",function(yes){
			if(yes){
				Base.submit("","wxRegisterController!removeWx.do",{"dto['id']":r.id},null,null,function(){
					Base.msgTopTip("删除成功!");
					fnQuery();
				});
			}
		}); 
	}
	
	/* 清空查询框  */
	function fnClear(){
		Base.setValue("appid","");
		Base.setValue("wxName","");
	}
</script>
<%@ include file="/ta/incfooter.jsp"%>